// create global variables -- it
const it = window.it = {}

// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import MintUI from 'mint-ui'
import './common/js/index'
import api from './common/js/api'
import * as util from './common/js/core'

/**
 * css
 */
import 'bulma/css/bulma.css'
import 'mint-ui/lib/style.css'
import './common/scss/index.scss'

/**
 * fonts
 */
import 'ionicons/dist/scss/ionicons.scss'

/**
 * global components (util & some common components)
 */
import header from './components/header/header'
import menu from './components/menu/menu'

import betterScroll from './utilComponents/better-scroll/better-scroll'
import mtMessageBox from './utilComponents/mt-message-box/mt-message-box'
import calendar from './utilComponents/calendar/calendar.vue'
import appTransition from './utilComponents/appTransition/appTransition.vue'

// 注册
Vue.component('it-header', header)
Vue.component('it-menu', menu)

Vue.component('better-scroll', betterScroll)
Vue.component('mt-message-box', mtMessageBox)
Vue.component('calendar', calendar)
Vue.component('app-transition', appTransition)

import router from './router'

Vue.config.productionTip = false

// 注册MintUi
Vue.use(MintUI)

//引入store
import store from './store'
// bind api and global methods to window.it
it.api = Vue.prototype.api = api
for (var prop in util) {
  it[prop] = Vue.prototype[prop] = util[prop]
}

/* eslint-disable no-new */
// cordova update
const vm = window.vm = new Vue({
  el: '#app',
  router,
  store,
  template: '<App/>',
  components: { App }
})
// bind store to window.it
it.store = vm.$store
// cordova update

// TODO: 两个文件相互导入的问题，导入的内容为undefined
// export default {
//   vm
// }
